﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Example14.aspx.cs" Inherits="Chapter27.Example14" %>

<!DOCTYPE html>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>代码清单 27-14 定位 window 对象并调用 postMessage 方法</title>
    <meta name="author" content="Adam Freeman" />
    <meta name="description" content="A simple example" />
    <style>
        iframe {
            width: 90%;
            height: 450px;
        }
    </style>
</head>
<body>
    <p id="status">Ready</p>
    <button id="send">Send Message</button>
    <p>
        <iframe name="nested" src="Example15.aspx"></iframe>
    </p>
    <script>
        document.getElementById("send").onclick = function () {
            window["nested"].postMessage("I like apples", "localhost");
            document.getElementById("status").innerHTML = "Message Send";
        }
    </script>
</body>
</html>
